The present invention relates to computer graphics, and more particularly to collecting and using information in a graphics pipeline for improving an output thereof.
A major objective in graphics rendering is to produce images that are so realistic that the observer believes the images are real. A fundamental difficulty in achieving total visual realism is the complexity of accurately representing real world visual effects. A scene can include a wide variety of textures, subtle color gradations, reflections, translucency, etc. To achieve this realism, much graphics information must be collected in the graphics pipeline.
For example, one important way to make images more realistic is to determine how objects in a scene cast shadows, and then represent these shadows in the rendered image. In order to accurately portray such shadows, information in the form of various z-values must be collected.
Various other examples of graphics processing techniques exist which are used to promote realism, and require the collection of additional information. In particular, transparency rendering, blending, layered depth images (LDIs), fog, etc. are all further examples of such graphics processing techniques.
Computer graphics pipeline designers are always searching for new, innovative ways to collect graphics information in the graphics pipeline for enabling new graphics processing techniques and improving existing graphics processing techniques.
A system and method are provided for using information from at least one depth layer and for collecting information about at least one additional depth layer utilizing a graphics pipeline. Initially, constraining depth layers are provided which, in turn, define a plurality of depth constraints. Such constraining depth layers may be received as results from various rendering passes or may be provided as some other user-created depth layers produced with a CPU or the like. Next, a plurality of tests is performed involving the constraining depth layers for collecting information about at least one additional depth layer. The information relating to the at least one depth layer may then be used to improve processing in the graphics pipeline.
By the foregoing multiple tests, information relating to a plurality of depth layers may be collected during each of a plurality of rendering passes. Initially, information relating to the constraining depth layers and associated depth constraints are provided in the aforementioned manner. Thereafter, information relating to at least one additional depth layer is collected during additional rendering passes using multiple tests on each rendering pass. Once collected, such information relating to the constraining depth layers and the information relating to the at least one additional depth layer may be used to further improve processing in the graphics pipeline.
In one embodiment, the information may include depth values, i.e. z-values. Of course, any other types of values, parameters, attributes, etc. may be collected per the desires of the user. As an option, the tests may include depth tests. Of course, however, the tests may optionally include stencil tests or any other desired fragment-level tests.
As mentioned earlier, the information relating to the initial constraining depth layers may be collected in any desired manner (i.e. during initial rendering passes, from a user-selected sources, etc.) In use, the information relating to the at least one additional depth layer may be collected during at least one additional rendering pass. The at least one additional rendering pass may be taken from an eye position from which previous rendering passes are taken.
As an option, shadow-mapping, alpha-test, z-test, and/or other similar hardware may be used to carry out the rendering passes in the previous embodiment. In such case, the information relating to the depth layers may take the form of shadow maps. Of course, the rendering passes may input and output depth layers in any form without the use of shadow-mapping techniques, and information may just as easily be collected from such rendering results.
In still another embodiment, the information relating to the at least one additional depth layer may be collected by removing a portion of the scene associated with a set of constraining depth layers. In particular, this may be accomplished by performing at least one test. In an embodiment where the test works from a front of the scene to a back of the scene, the test may determine whether the portion of the scene associated with the constraining depth layers is in front of the at least one additional depth layer. If it is determined that the portion of the scene associated with the at least one additional depth layer is in front of the constraining depth layers, the particular portion of the scene is removed. Of course, the test may also work from the back of the scene to the front of the scene. Further, multiple tests may be performed to remove numerous portions of the scene or in a more selective form.
In one aspect of the present embodiment, the test may calculate differences between z-values relating to the constraining depth layers and a z-value relating to the at least one additional depth layer. In operation, a particular portion of the scene may be removed based on a test calculated involving the z-values relating to the constraining depth layers and the z-value relating to the at least one additional depth layer.
In the context of the embodiment where shadow mapping hardware is utilized, the z-values relating to the constraining depth layers may be computed using the same hardware method that produces the z-values corresponding to the at least one additional depth layer, which improves accuracy of the tests.
These and other advantages of the present invention will become apparent upon reading the following detailed description and studying the various figures of the drawings.